package com.wwz.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

import java.util.HashMap;
import java.util.Map;


/**
 * <p>Description:启动流程实例，动态设置assignee</p >
 * <p>Copyright: Copyright (c)2021</p >
 * <P>Created Date :2021-04-07</P>
 * <P>@version 1.0</P>
 */
public class AssigneeUEL {
    public static void main(String[] args) {
        //1.得到ProcessEngine对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

        //2.得到 runtimeService
        RuntimeService runtimeService = processEngine.getRuntimeService();

        //3.设置assignee的取值  用户可以在界面上设置流程的执行人
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("assignee0", "wangwanzhao");
        map.put("assignee1", "lisi");
        map.put("assignee2", "wangwu");

        //4.启动流程实例
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holiday2", map);

        //5.输出信息
        System.out.println(processInstance.getName());
    }
}
